package com.ynnu.changming.majiang_algorithm;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by bjzhaoxin on 2017/11/17.
 */

//胡牌算法的箭牌常用方法类
public class HuTableJian
{
//	Hashtable和HashMap都实现了Map接口，但是Hashtable的实现是基于Dictionary抽象类的。Java5提供了ConcurrentHashMap，它是HashTable的替代，比HashTable的扩展性更好。


    //	table为全局静态变量
	public static ConcurrentHashMap<Long, List<HuTableInfo>> table = new ConcurrentHashMap<>();
	public static String ziname[] = new String[]
	{ "中", "发", "白" };

	public static void gen()
	{
		HuCommon.table = table;
		HuCommon.N = 3;
		HuCommon.NAME = "jian";
		HuCommon.CARD = ziname;
		HuCommon.huLian = false;
		HuCommon.gen();

	}




	public static void load()
	{
//		洗牌
		table.clear();

		HuCommon.table = table;

		HuCommon.N = 3;  //中发白 三个箭牌
		HuCommon.NAME = "jian";
		HuCommon.CARD = ziname;
		HuCommon.huLian = false;

		// 从majiang_clien_jian.txt 文本中读出   todo
		HuCommon.load();
	}

	public static void load(List<String> lines)
	{
		table.clear();
		HuCommon.table = table;
		HuCommon.N = 3;
		HuCommon.NAME = "jian";
		HuCommon.CARD = ziname;
		HuCommon.huLian = false;
		HuCommon.load(lines);
	}
}